<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

	<ui:composition 
	  xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      template="/view/templates/templateLayout.xhtml">
      
      <ui:define name="conteudo">  
      <link rel="stylesheet" type="text/css" href="./estilos.css"/>     	
  	
<h:form id="formConsultarContaReceber">  
	<p:panel id="panelConsultarContaReceber" style="margin-bottom:20px; "> 
	<f:facet name="header">
		<h:outputText value="Consultar Contas a Receber" styleClass="outputTextTitulo"/>
	</f:facet> 
 	<p:growl id="growl" showDetail="true"/> 
    	<h:panelGrid id="pgContaReceber" columns="3" style="margin-top:20px; margin-right:10%;">  
            <h:outputLabel value="Código" styleClass="outputLabel" />  
            <h:outputLabel value="Descricao" styleClass="outputLabel" /> 
            <h:outputLabel value="Data Vencimento" styleClass="outputLabel" /> 
            <p:inputText value="#{contaReceberBean.contaReceber.idContaReceber}" styleClass="inputId"/> 
            <p:inputText value="#{contaReceberBean.contaReceber.descricao}" styleClass="inputDescricao"/>  
  			<p:inputMask value="#{contaReceberBean.contaReceber.dtVencimento}" mask="99/99/9999" >
  				<f:convertDateTime dateStyle="medium"/>
  			</p:inputMask>
        </h:panelGrid>  
        <h:panelGrid id="pgAluno" columns="2" >  
            <h:outputLabel value="Código" styleClass="outputLabel" />  
            <h:outputLabel value="Aluno" styleClass="outputLabel" /> 
            <p:inputText value="#{contaReceberBean.contaReceber.aluno.idAluno}" styleClass="inputId">
            	<p:ajax  listener="#{contaReceberBean.onChangeAluno}" render="pgAluno" />
            </p:inputText>  
  			<p:autoComplete  value="#{contaReceberBean.contaReceber.aluno.nome}" 
                    completeMethod="#{contaReceberBean.completeAluno}"  >
            	<p:ajax event="itemSelect" listener="#{contaReceberBean.handleSelectAluno}" update="pgAluno" />
			</p:autoComplete>  
        </h:panelGrid> 
    </p:panel>  
    <p:commandButton value="Consultar" actionListener="#{contaReceberBean.findContaReceber}" update="dataTableContaReceber" style="margin-right:20px; margin-left:10px;" /> 
	<p:commandButton value="Novo" action="#{contaReceberBean.newContaReceber}" style="margin-right:20px;" /> 
	<p:commandButton value="Limpar"  actionListener="#{contaReceberBean.clean}" style="margin-right:20px;" />
    		
   		
    <p:dataTable id="dataTableContaReceber" var="ContaReceber"  value="#{contaReceberBean.findContaReceber()}"
    			 rowKey="#{ContaReceber.idContaReceber}"  selectionMode="single"
                 style="padding-top:20px; width:70%">  
        <f:facet name="header">Contas a Pagar</f:facet>    
		<p:column style="width:10%; text-align:center;">  
            <f:facet name="header">  
                <h:outputText value="Código" />  
            </f:facet>  
            <h:outputText value="#{ContaReceber.idContaReceber}" />  
        </p:column>  
  
        <p:column style="width:30%;">  
            <f:facet name="header">  
                <h:outputText value="Aluno" />  
            </f:facet>  
            <h:outputText value="#{ContaReceber.aluno.nome}" />  
        </p:column>
        
        <p:column style="width:20%;">  
            <f:facet name="header">  
                <h:outputText value="Descrição" />  
            </f:facet>  
            <h:outputText value="#{ContaReceber.descricao}" />  
        </p:column>
          
        <p:column style="width:10%; text-align:center;">  
            <f:facet name="header">  
                <h:outputText value="Data Vencimento" />  
            </f:facet>  
            <h:outputText value="#{ContaReceber.dtVencimento}" >
            	<f:convertDateTime dateStyle="medium"/>
            </h:outputText>  
        </p:column>
        <p:column style="width:10%; text-align:center;">  
            <f:facet name="header">  
                <h:outputText value="Data Pagamento" />  
            </f:facet>  
            <h:outputText value="#{ContaReceber.dtPagamento}" >
            	<f:convertDateTime dateStyle="medium"/>
            </h:outputText>  
        </p:column>
        
        <p:column style="width:10%">  
            <f:facet name="header">  
                <h:outputText value="Valor" />  
            </f:facet>  
            <h:outputText value="#{ContaReceber.valor}" >
            	<f:convertNumber type="currency" currencySymbol="R$ " maxFractionDigits="2" minFractionDigits="2"/>/>
            </h:outputText>  
        </p:column>
        
        <p:column style="width:4%">  
        	<f:facet name="header">
        	 <h:outputText value="Editar" />
        	</f:facet>
         	<p:commandButton id="selectButtonEditar"  icon="ui-icon-pencil" title="Detail" />
        </p:column> 
    </p:dataTable>   
 
</h:form>  	


</ui:define>
</ui:composition>
